Skip to content

id(web): accept u64 values above 2^53 in the TS shell-contract checker (#1441) - #2874

Merged
dezren39 merged 2 commits into
mainfrom
queue/1748-1441-u64-parity
Oct 31, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/1748-1441-u64-parity

Conversation

@dezren39

@dezren39 dezren39 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What

Fixes #1441: the TypeScript shell-contract checker capped every u64 field at Number.MAX_SAFE_INTEGER, while the Rust checker caps u64 at u64::MAX and the contract leaves most u64 fields open — so contract-valid frames (install_begin seeds, view/records sequences at or above 2^53, a value class the system itself produces) were falsely rejected with a bound that appears nowhere in the contract.

How

checkValue in pkgs/id/web/src/shell-contract.ts now handles u64 on its own, mirroring the Rust verdicts within JS precision limits:

  • A non-negative integer is accepted at any JS-representable magnitude: a wire value above 2^53 arrives already rounded and cannot be proven out of range.
  • Bounds JS can check exactly still are: negative and non-integer values are rejected; an explicit min is enforced; an explicit max within the safe range (e.g. total_bytes ≤ 16777216) still rejects above-max values.
  • u16/u32 caps are unchanged; the Rust checker and the contract JSON are untouched.
  • A comment at the cap explains the precision constraint; u64 error messages no longer cite 9007199254740991.
  • Regression tests in world-contract.test.ts pin the parity cases: seed = 2^53 and the JSON-parsed form of u64::MAX accepted, view/records sequences at 2^53 accepted, and the exactly-checkable bounds still rejecting.

Verification

  • bun x vitest run src/world-contract.test.ts — 17/17 pass (laptop).
  • bun run typecheck — clean.
  • Full web suite: 478 pass, 1 failure in search-panel.test.ts (accessibility role) that fails identically on clean main — pre-existing, unrelated.

Queue task 1748 (resumed from a park whose only blocker was the 2026-10-28 laptop SSH outage).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

#1441)

The TS port capped every u64 at Number.MAX_SAFE_INTEGER while the Rust checker caps at u64::MAX and the contract leaves most u64 fields open, so contract-valid frames (install_begin seeds, view/records sequences) were falsely rejected with a bound that appears nowhere in the contract.

u64 is now checked on its own: non-negative integers are accepted at any JS-representable magnitude (a wire value above 2^53 arrives rounded and cannot be proven out of range), while the bounds JS can check exactly still are -- an explicit min, and an explicit max within the safe range (total_bytes <= 16777216 still rejects). Regression tests pin the parity cases from #1441; the one failing web test (search-panel accessibility) fails identically on clean main.
@dezren39
dezren39 requested a review from a team as a code owner October 30, 2026 23:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T02:24:07.184466Z 8748a88 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c0641d11-de68-4ea5-b2e1-eee71a025c45
Commits

Reviewing files that changed from the base of the PR and between c6564aa and 8748a88.

Files selected for processing: 2
  • pkgs/id/web/src/shell-contract.ts
  • pkgs/id/web/src/world-contract.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d02d9a1694

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/id/web/src/shell-contract.ts Resolved
…ntract checker (#1441)

2^64 is the rounded wire form of u64::MAX itself and stays accepted,
but anything above it (2**65, 1e100) is unambiguously out of range and
the Rust checker rejects it via value.as_u64() -- the TS port must too,
or conformance tests would approve frames the host rejects. Pins the
Codex P2 boundary cases in world-contract.test.ts.
@dezren39
dezren39 merged commit 321dc21 into main Oct 31, 2026
1 check passed
@dezren39
dezren39 deleted the queue/1748-1441-u64-parity branch October 31, 2026 02:24
@dezren39

Copy link
Copy Markdown
Member Author

🤖 Agent note · done

  • Agent: queue worker (repo-worker-code), openchamber scheduled lane
  • Session / ID: queue task 1748
  • Found via: queue claim (resumed prior-shift branch)
  • Task: Codex P2 addressed in 8748a88 — u64 values provably above range (> 2^64) rejected with the true 0..=18446744073709551615 bound; 2^64 stays accepted as the rounded wire form of u64::MAX; P2 thread PRRT_kwDOJWP4786yLX67 replied + resolved. Verified: targeted file 18/18, full web suite 479 passed (1 pre-existing unrelated search-panel aria failure, untouched files), tsc --noEmit clean. No CI check-runs on this PR (CodeRabbit only, neutral) — verified locally on the laptop instead.
  • Expectation: merged as 321dc21
  • Links: queue task 1748, issue id(web): TS shell-contract checker rejects valid u64 values above 2^53-1 that the Rust checker accepts (seed, sequence, offset) #1441

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(web): TS shell-contract checker rejects valid u64 values above 2^53-1 that the Rust checker accepts (seed, sequence, offset)

1 participant